package org.ami.onlineschool.ui;

import java.util.List;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.ListModel;

public class UIUtilities {

	static DefaultListModel getListModel(JList lst) {
		ListModel model = lst.getModel();
		if(!(model instanceof DefaultListModel)) {
			model = new DefaultListModel();
			lst.setModel(model);
		}
		return (DefaultListModel) model;
	}

	static void populateModelFromList(DefaultListModel model, List<?> courses) {
		for (Object object : courses) {
			model.addElement(object);
		}
		
	}


}
